# 导入又拍云
import upyun
# 封装类
class MyUp:
    # 初始化
    def __init__(self):
        # '服务名称'，'操作员账号','操作员密码'
        upyun.UpYun('image-zhouxingkai','zhouxingkai','dzcBxsWJhTf8ePghfddiR93OleeuXgD9')

    # 上传文件
    def upload(self,upload_dir,file,userid):
        with open(upload_dir+str(userid)+"/"+file,'rb')as f:
            self.up.put('/'+str(userid)+'/'+file,f)

myup = MyUp()
# 文件路径包括文件名称,要上传文件名称,要建的文件名称
myup.upload('D:/p6/p6_education/static/upload/','123.jpg',1)
